function ber=test_optimal_detector_qpsk()

power=10;	%total power being transmitted
noise=1;	%noise at each receiver
rho=power/noise;
corr_upper_bounds=.9;

antennas=[2];
training=[0];
largenumber=1;

for a=1:length(antennas)

	[s,byte_sequence]=transmit_qpsk_gray(antennas(a));

	for b=1:length(training)

		%detection methods
		for c=1:1
			%simulation
			for d=1:largenumber
				h_corr=correlated_channel(antennas(a),antennas(a),0,corr_upper_bounds);
				h_uncorr=uncorrelated_channel(antennas(a),antennas(a));
				h_corr_hat=channel_estimation(h_corr,noise,rho,antennas(a),training(b)*antennas(a));
				h_uncorr_hat=channel_estimation(h_uncorr,noise,rho,antennas(a),training(b)*antennas(a));
	
				v=noise*randn(antennas(a),1) + j*noise*randn(antennas(a),1);
				ber_corr(d)=blast_accuracy(byte_sequence,blast_detection(c,h_corr,s,v,rho,antennas(a)));
				ber_uncorr(d)=blast_accuracy(byte_sequence,blast_detection(c,h_uncorr,s,v,rho,antennas(a)));
			end
			ber(a,b,c,1)=mean(ber_corr);
			ber(a,b,c,2)=mean(ber_uncorr);
		end
	end
end

